let nums = [0,0,1,1,1,2,2,3,3,4]

let newSet = new Set([...nums])
return newSet.size
//     nums = Array.from(newSet)
//     return nums.length
let removeDuplicates = function(nums){
    let idx = 1;
    let len = nums.length
    let temp = nums[0]
    while(idx < len){
        if(nums[idx] == temp){
            nums.splice(idx, 1)
            len--
        }else{
            temp = nums[idx]
            idx++
        }
    }
    return nums.length
}

removeDuplicates(nums)
console.log(nums)